<!DOCTYPE html>
<html>
<head>
    

    {include file="public/link"}
    <title>{$seo.meta_title}</title>
    <meta name="Keywords" content="{$seo.meta_keyword}" />
    <meta name="Description" content="{$seo.meta_description}" />
</head>
<body>

<!-- End Google Tag Manager (noscript) -->
<div class="header_line">
    <!-- line 1 -->
    <div class='header_row'>
        <ul class='header_welcome'>
            
        </ul>
        <ul class='header_nav layui-nav'>
            <dl class="layui-nav-item">
                <a>{:__('我的任务')}</a>
                <dl class="layui-nav-child">
                    <dd><a href="/index/Task/tasksub">{:__('发布悬赏任务')}</a></dd>
                </dl>
            </dl>|
            <dl><a href="/index/Index/release">{:__('找人写稿')}</a></dl>|
            <dl class="layui-nav-item help_show">
                <a href="#">{:__('网站导航')}</a>
                <dl class="layui-nav-child" style="width: 200%;flex-wrap: wrap;">
                    <dd style="width: 100%;"><a href=""><b>{:__('所有服务')}</b></a></dd>
                    <dd style="width: 50%;"><a href="/index/Index/release">{:__('任务发布')}</a></dd>
                    <dd style="width: 50%;"><a href="/index/User/online">{:__('在线充值')}</a></dd>
                    <dd style="width: 50%;"><a href="/index/User/user">{:__('个人中心')}</a></dd>
                </dl>
            </dl>|
            <dl><a href="/index/Artical/articallist?catid=75">{:__('帮助中心')}</a></dl>|
            <dl class="layui-nav-item">
                <a ><span id="languageshow">{:__('语言')}</span></a>
                <dl class="layui-nav-child" id="language">
                    
                </dl>
            </dl>
        </ul>
    </div>
</div>
<script>
    if(token != ''&& token != null && token != undefined){

        var userData = getLocalStorage('userData');
        objs = {'userData':1}
        CacheLoad(objs);

        $(document).queue('user',function(){
            var userData = getLocalStorage('userData');
            var userdata = JSON.parse(userData);
            var username = userdata['username'];
            $(".header_welcome").html("<dl>{:__('您好')},<a href='/index/User/user'>"+username+'!</a></dl>&nbsp;<a id="logout">{:__("退出")}</a>');
            $(document).dequeue('user');
        });

    } else {
        $(".header_welcome").html("<dl>{:__('您好,欢迎来到任务悬赏系统')}</dl><a class='login' href='/index/Index/login'>{:__('请登陆')}</a><a class='regist'href='/index/Index/regist'>{:__('免费注册')}</a>");
    }
    langhtl = "";
    var langData = getLocalStorage('langset');
    function getLang()
    {
        var langData = getLocalStorage('langset');
        if(langData != '' && langData != undefined && langData != null){
            var langDataObj = JSON.parse(langData);
            for(i in langDataObj['langs']){
                langhtl += '<dd><a class="langs" data-target="'+langDataObj['langs'][i]+'">{:__("'+langDataObj['langs'][i]+'")}</a></dd>';
            }
        }
        $("#language").html(langhtl);

        var langs = localStorage.getItem("langs");
        if(langs != '' && langs != undefined && langs != null){
            var htl = $("a[data-target="+langs+"]").html();
            $("#languageshow").html(htl)
        } else {
            var win_lang = window.chrome_lang;
            var htl = $("a[data-target="+win_lang+"]").html();
            $("#languageshow").html(htl);
        }
    }
    if(langData == '' || langData == null || langData == undefined){
        objs = {'langset':1}
        CacheLoad(objs);
        $(document).queue('langset,',function(){
            getLang();
        });
    } else {
        getLang();
    }
    
    
    $(document).on("click","#logout",function(){
        $.ajax({
            url:'/api/user/logout',
            type:'post',
            data:{'token':token},
            success:function(ret){
                if(ret.code != 401 && ret.code != 1){
                    layer.msg(ret.msg,{icon:2});
                } else if(ret.code == 1) {
                    layer.msg(ret.msg,{icon:1},function(){
                        removelocal();
                        window.location.reload();
                    });
                }
            }
        });
    });
    $(document).on('click',".langs",function(){
        var _this = $(this);
        var lang = _this.attr('data-target');
        localStorage.setItem("langs",lang);
        changeLang(lang);
    });
</script>